package cn.bgs.controller;

import cn.bgs.service.Cwlservice;
import cn.bgs.utils.R;
import cn.bgs.vo.TemporVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/temporary-car-park")
public class TemporaryCarParkController {
    @Autowired
    Cwlservice cwlservice;

    //停车缴费全查
    @RequestMapping("/selectParkInfo")
    public R selectParkInfo(@RequestBody TemporVo temporVo) {
        return cwlservice.selectParkInfo(temporVo);
    }

    //修改
    @PostMapping("/updateParkInfo")
    public R updateParkInfo(@RequestBody TemporVo temporVo) {
        if (cwlservice.updateParkInfo(temporVo)) {
            return R.ok();
        }
        return R.error();
    }

    //添加
    @PostMapping("/aedParkInfo")
    public R aedParkInfo(@RequestBody TemporVo temporVo) {
        boolean a = cwlservice.aedParkInfo(temporVo);
        return R.ok().data("data", a);

    }

    //删除
    @GetMapping("/deleteParkInfo")
    public R deleteParkInfo(Integer temporaryCarParkId) {
        return cwlservice.deleteParkInfo(temporaryCarParkId);
    }
}